<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../javascripts/jquery.min.js"></script>
    <style>
        img {
            width: 300px;
            height: 300px;
        }
    </style>
</head>

<body>
    <input type="file" name="" id="myFile">
    <input type="button" value="提交" id="btn">
    <div class="img"></div>

</body>
<script>
    $('#btn').on('click', function() {
        let f = document.querySelector('#myFile').files[0];
        let formData = new FormData();
        formData.append('file', f);
        $.ajax({
            url: '/show/img',
            type: 'post',
            data: formData,
            success: function(data) {
                let content = ''
                content += `<img src="${data.data} " alt="">`
                $(".img").append(content)
            },
            contentType: false,
            processData: false,
            cache: false

        })
    })
</script>

</html>